Skip to content

[Fix] #542 - /poke/friend 404 에러 처리 #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 10, 2025

Conversation

yungu0010
Copy link
Contributor

@yungu0010 yungu0010 commented Apr 7, 2025

🌴 PR 요약

콕찌르기 진입 시 발생하는 에러를 방지하기 위한 분기 처리를 추가했습니다.

🌱 작업한 브랜치

🌱 PR Point

✅ 문제 원인

#533 이슈를 해결하는 과정에서 콕찌르기 진입 시마다, 에러가 발생하는 것을 확인했습니다. 원인은 기존 로직의 잘못된 분기 처리였습니다.

기존 콕찌르기 진입 흐름:

  1. 홈에서 콕찌르기 클릭 시 딥링크로 화면 전환(home/poke)
  2. 딥링크에서 pokeMainVC 로드
  3. VC의 viewDidLoad에서 세 가지 API 호출(/poke/friend)
  4. 동시에 /poke/new를 호출하여 신규 유저 여부 확인
  5. 신규 유저일 경우 온보딩 화면으로 전환

이 흐름에서 신규 유저의 경우, 이미 PokeMainVC가 메모리에 로드 된 뒤 온보딩으로 화면 전환되기 때문에 친구 데이터가 존재하지 않아 /poke/friend API에서 404에러가 발생하고 있었습니다.

서버 에러 알림 클라이언트 에러 로그
스크린샷 2025-04-08 오전 2 03 24 스크린샷 2025-04-08 오전 2 02 05

✅ 문제 해결

PokeMainVC가 메모리에 올라가기 전인 홈 뷰모델에서 /poke/new 로 신규 유저 여부를 판단하고,
신규 유저면 → 온보딩,
기존 유저면 → 메인으로 분기되도록 처리했습니다.

✅ 고려 사항

다른 경로로 PokeMainVC가 호출될 수 있기 때문에, 기존 PokeMainViewModel의 분기 처리 로직은 삭제하지 않았습니다.
우선 지금까지 떠올린 경우의 수는 세 가지 입니다.

1️⃣ 홈뷰에서 진입
딥링크를 사용하지 않고 isNewUser에 따라 분기처리 해줌(해당 이슈에서 수정)

2️⃣ 알림으로 진입
PokeNotificationViewController로 이동
푸시알림을 통해 이동한 경우, 딥링크를 사용하기 때문에 pokeMain을 로드하게 됨

3️⃣ 솝마디를 통해 진입
PokeOnboarding 또는 PokeMain으로 진입하지 않음.

이 중에서 2번의 경우를 때문에 기존 로직의 코드를 남겨두었습니다.(#533 이슈를 해결하려면 아직 친구관계가 없는 상황이 필요해 확인하지 못했어요.)
혹시 제가 떠올리지 못한 경우가 있다면 알려주세요!

📌 참고 사항

  • HomeForMemberViewModel에서 콕찌르기 분기처리 부분의 코드를 더 깔끔하게 작성할 수 있는 방법이 있을까요?
  • 콕찌르기 구조가 정말 복잡하네요. 콕찌르기 부분을 리팩토링하면서 변수명 짓기에 더 많은 시간을 투자해야겠다는 생각이 듭니당 . .

📮 관련 이슈

@yungu0010 yungu0010 added Fix 문제 해결, 코드 수정 윤서🍉 labels Apr 7, 2025
@yungu0010 yungu0010 self-assigned this Apr 7, 2025
Copy link

height bot commented Apr 7, 2025

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Copy link
Contributor

@dlwogus0128 dlwogus0128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

놓친 부분까지 꼼꼼하게 발견해주셔서 감사합니다~!

}.store(in: cancelBag)
} else {
owner.onAppServiceCellTapped?(model.deepLink)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 함수로 분리해주시면 좋을 것 같아요~!!

글고 serviceName으로 기능을 필터링하는 게 별로 좋아보이지는 않는데... service type을 관리하는 enum 만드는 건 어떻게 생각하세요? 저희가 서비스 네임까지 전부 서버에서 내려주는 값에 의존하기로 한 건 클라에서의 분기를 최소화하기 위함이었는데, 어쩔 수 없이 이렇게 클라에서 분기해야 할 필요가 있다면 (문자열이 아닌) 의미 단위로 분기할 수 있도록 enum에 맵핑해주는 게 좋을 것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞아요. 원래 Core 모듈 내 AppServiceType을 활용하려고 했는데, 해당 enum을 HomeFeature에 맞게 변경하려면 홈 개편 전인 MainFeature 부분도 수정해야해서 사용 보류했습니다! #540 에서 MainFeature 코드 삭제 후에 기존 Enum 적용해서 수정하도록 할게요! 좋은 의견 감사합니다👍

@yungu0010 yungu0010 merged commit 879a48b into develop Apr 10, 2025
@yungu0010 yungu0010 deleted the fix/#542-poke/friend-error branch April 10, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix 문제 해결, 코드 수정 size/M 윤서🍉
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fix] /poke/friend 404 에러 처리
2 participants